let star = {
    name:"刘亦菲",
    age:32,
    phone:13902400033
}
let agent = new Proxy(star,{
    get(target,key){
        if (key === "phone"){return '13902400054'}
        if (key === "price"){return 120000}
        return target[key]
    },
    set(target,key,val){
        if (key === "custorprice"){
            if (val < 100000){
                throw new  Error ('价格太低')
            } else {
                target[key] = val
                return true
            }
        }
    }
})

console.log("明星的年龄为:"+agent.age+"明星的电话为:"+agent.phone+"初始价格为"+agent.price)
console.log("-------------谈价-------------------")
agent.custorprice = 150000
console.log("谈价为:"+agent.custorprice)
export default {
    agent
}